package ren.kane.asdppp.transaction.change.affiliation;

import ren.kane.asdppp.PayrollDatabase;
import ren.kane.asdppp.affiliation.Affiliation;
import ren.kane.asdppp.affiliation.UnionAffiliation;
import ren.kane.asdppp.Employee;

/**
 * @author renrk(1275) on 2019-04-20 10:17 PM
 **/
public class ChangeMemberTransaction extends ChangeAffiliationTransaction {

    private int memberId;

    private double amount;

    public ChangeMemberTransaction() {
    }

    public ChangeMemberTransaction(int empId, int memberId, double amount) {
        super(empId);
        this.memberId = memberId;
        this.amount = amount;
    }

    @Override
    protected Affiliation getAffiliation() {
        return new UnionAffiliation(memberId, amount);
    }

    @Override
    protected void recordMemberShip(Employee employee) {
        PayrollDatabase.addUnionEmployee(memberId, employee);
    }
}
